<div>


  <m-button>normal</m-button>
  <m-button theme="color">color</m-button>
  <m-button theme="outlined">outlined</m-button>
  <m-button theme="outlined-color">outlined color</m-button>
  <m-button theme="flat">flat</m-button>
  <m-button theme="flat-color">flat color</m-button>
  <hr>

  <m-button theme="color" mode="float">color</m-button>

  <m-button mode="float-icon" theme="color">
    <m-icon value="add"></m-icon>
  </m-button>
  <m-button mode="float-icon" theme="color" size="small">
    <m-icon value="add"></m-icon>
  </m-button>
  <m-button mode="float-icon" theme="color" size="large">
    <m-icon value="add"></m-icon>
  </m-button>

  <hr>
  <m-button raised="true">normal</m-button>
  <m-button raised="true" theme="color">color</m-button>
  <m-button raised="true" theme="outlined">outlined</m-button>
  <m-button raised="true" theme="outlined-color">outlined color</m-button>
  <m-button raised="true" theme="flat">flat</m-button>
  <m-button raised="true" theme="flat-color">flat color</m-button>
  <hr>
  <m-button>
    <m-icon slot="start" value="add"></m-icon>
    normal
  </m-button>
  <m-button>
    normal
    <m-icon slot="end" value="add"></m-icon>
  </m-button>
  <hr>
  <m-button mode="icon">
    <m-icon value="add"></m-icon>
  </m-button>
  <m-button mode="icon" theme="color">
    <m-icon value="add"></m-icon>
  </m-button>
  <m-button mode="icon" theme="outlined">
    <m-icon value="add"></m-icon>
  </m-button>
  <m-button mode="icon" theme="outlined-color">
    <m-icon value="add"></m-icon>
  </m-button>
  <m-button mode="icon" theme="flat">
    <m-icon value="add"></m-icon>
  </m-button>
  <m-button mode="icon" theme="flat-color">
    <m-icon value="add"></m-icon>
  </m-button>
  <hr>
  <m-button size="small">small</m-button>
  <m-button size="normal">normal</m-button>
  <m-button size="large">large</m-button>

  <m-button size="small" mode="icon">
    <m-icon value="add"></m-icon>
  </m-button>
  <m-button size="normal" mode="icon">
    <m-icon value="add"></m-icon>
  </m-button>
  <m-button size="large" mode="icon">
    <m-icon value="add"></m-icon>
  </m-button>
</div>

<template>
  <style>
    :host {
      display: inline-block;
      vertical-align: middle;
      min-height: 36px;
      border-radius: 2px;
      min-width: 72px;
      background: var(--color-border);
      text-transform: uppercase;
      cursor: pointer;
      user-select: none;
      font-size: .9rem;
      letter-spacing: 1px;
      position: relative
    }

    :host([raised=true]) .root {
      transition: box-shadow .2s;
      box-shadow: 0 2px 1px -1px rgba(0, 0, 0, .2), 0 1px 1px 0 rgba(0, 0, 0, .14), 0 1px 3px 0 rgba(0, 0, 0, .12)
    }

    :host([raised=true]) .root[active] {
      box-shadow: 0 5px 5px -3px rgb(0 0 0 / 20%), 0px 8px 10px 1px rgb(0 0 0 / 14%), 0px 3px 14px 2px rgb(0 0 0 / 12%)
    }

    :host([disabled=true]) {
      pointer-events: none;
      filter: grayscale(1);
      opacity: .6
    }

    :host([theme=color]) {
      background: rgba(var(--color-accent));
      color: #fff;
      --color-icon: #fff;
      --color-ripple: rgba(255, 255, 255, .4)
    }

    :host([theme^=flat]) {
      background: 0
    }

    :host([theme=flat-color]) {
      color: rgba(var(--color-accent));
      --color-icon: rgba(var(--color-accent));
      --color-ripple: rgba(var(--color-accent), .24)
    }

    :host([theme^=outlined]) {
      background: 0
    }

    :host([theme^=outlined])::before {
      content: '';
      height: 100%;
      width: 100%;
      position: absolute;
      left: 0;
      top: 0;
      border-radius: inherit;
      border: solid 1px var(--color-border);
      pointer-events: none;
      box-sizing: border-box
    }

    :host([theme^=outlined-color]) {
      --color-icon: rgba(var(--color-accent));
      --color-ripple: rgba(var(--color-accent));
      color: rgba(var(--color-accent))
    }

    :host([theme^=outlined-color])::before {
      border-color: rgba(var(--color-accent))
    }

    :host([theme=outlined-color]) .root[active] {
      color: #fff;
      --color-icon: #fff !important
    }

    :host([mode=icon]) {
      border-radius: 50%;
      min-width: auto;
      width: 40px;
      height: 40px
    }

    :host([mode=icon]) .root,
    :host([mode=float-icon]) .root {
      padding: 0 !important
    }

    :host([mode^=float]) {
      border-radius: 24px;
      height: 40px;
    }

    :host([mode^=float]) .root {
      transition: box-shadow .2s;
      box-shadow: 0px 3px 5px -1px rgb(0 0 0 / 20%), 0px 6px 10px 0px rgb(0 0 0 / 14%), 0px 1px 18px 0px rgb(0 0 0 / 12%);
      padding: 0 20px;
    }

    :host([mode^=float]) .root[active] {
      box-shadow: 0px 7px 8px -4px rgb(0 0 0 / 20%), 0px 12px 17px 2px rgb(0 0 0 / 14%), 0px 5px 22px 4px rgb(0 0 0 / 12%);
    }

    :host([mode=float-icon]) {
      border-radius: 50%;
      min-width: auto;
      width: 40px;
    }

    :host([size=large]),
    :host([size=small]) {
      min-height: auto
    }

    :host([size=small]) {
      min-height: 32px;
      font-size: .8125rem;
      min-width: 56px
    }

    :host([size=small][mode=icon]),
    :host([size=small][mode=float-icon]) {
      width: 36px;
      height: 36px;
      min-width: auto
    }

    :host([size=small][mode=float]) {
      height: 36px;
    }

    :host([size=large]) {
      min-height: 40px;
      font-size: 1rem;
      min-width: 72px
    }

    :host([size=large][mode=icon]),
    :host([size=large][mode=float-icon]) {
      width: 48px;
      height: 48px;
      min-width: auto
    }

    :host([size=large][mode=float]) {
      height: 48px;
    }

    :host([size=small]) ::slotted(m-icon) {
      font-size: 20px;
      width: 20px;
      height: 20px
    }

    .root {
      border-radius: inherit;
      min-height: inherit;
      height: inherit;
      display: flex;
      justify-content: center;
      padding: 6px 8px;
      box-sizing: border-box;
      align-items: center;
      overflow: hidden
    }

    span {
      line-height: 1;
      position: relative;
      pointer-events: none
    }

    ::slotted(*) {
      flex-shrink: 0;
      display: block;
      position: relative
    }

    ::slotted([slot=start]) {
      margin-right: 8px
    }

    ::slotted([slot=end]) {
      margin-left: 8px
    }
  </style>
  <m-ripple class="root" part="root">
    <slot name="start"></slot><span>
      <slot></slot>
    </span>
    <slot name="end"></slot>
  </m-ripple>
</template>

<script type="module">
  import '../icon/main.js'
</script>

<script type="module">
  import { define } from '../../core.js'
  import '../ripple/main.js'

  const template = $template
  const props = ['disabled', 'theme', 'raised', 'mode', 'size']
  const setup = () => {
    return {
      disabled: false,
      theme: ['normal', 'color', 'flat', 'flat-color', 'outlined', 'outlined-color'],
      raised: false,
      mode: ['normal', 'icon', 'float', 'float-icon'],
      size: ['normal', 'small', 'large']
    }
  }

  define('button', { template, props, setup })
</script>